package main

import (
	"fmt"
	"github.com/json-iterator/go"
)

type User struct {
	Id int `json:"id,string"`
	Name string `json:"name"`
	Age int `json:"age,omitempty"`
	Addr string `json:"-"`
}
func main() {
	var json = jsoniter.ConfigCompatibleWithStandardLibrary
	u:=User{
		Id: 11,
		Name: "gene",
		Age: 10,
		Addr: "武汉江岸",
	}

	data, err:=json.Marshal(&u)
	if err != nil {
		fmt.Errorf("%v",err)
	}
	fmt.Println(string(data))

	//
	u2:= &User{}
	err=json.Unmarshal(data, u2)
	if err != nil {
		fmt.Errorf("%v",err)
	}
	fmt.Printf("%+v \n", u2)
}
